package id.co.rho.scoring.cid.server.util;

import java.lang.reflect.Method;

/**
 * Created by IntelliJ IDEA.
 * User: bungrudi
 * Date: 8/9/11
 * Time: 10:26 AM
 */
public class ServerUtil {
   
    public static boolean isTransientEntity(Object entity) {
        try {
            Method methodGetId = entity.getClass().getMethod("getId", null);
            Object id = methodGetId.invoke(entity, null);
            if (id == null) {
                return true;
            }
            return false;
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}
